package com.jfree.nettyshow.common;

import java.util.Map;

public class Result {

    private String code;

    private Map<String, Object> data;

    public Result() {

    }

    public Result(String code) {
        this.code = code;
    }

    public Result(String code, Map<String, Object> data) {
        this.code = code;
        this.data = data;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }

    /**
     * 业务错误
     *
     * @return
     */
    public static Result fail() {
        return new Result("-1");
    }
/**
 * 服务器错误
 */
public static Result failServer() {
    return new Result("-3");
}
    /**
     * 没有登录错误
     *
     * @return
     */
    public static Result loginErr() {
        return new Result("-2");
    }

    @Override
    public String toString() {
        return "Result{" +
                "code='" + code + '\'' +
                ", data=" + data +
                '}';
    }
}
